import React, { Component } from 'react';
import { connect } from "react-redux";
import { Table, Modal, Popconfirm, message,Tooltip } from 'antd';
import AddInfo from './component/AddInfo'
class OfflineMsgList extends Component {
    constructor(props) {
        super(props);
        this.state = {
            data: [],
            pageNum: 1,
            pageSize: 10,

        }

        this.columns = [
            {
                title: 'ID',
                dataIndex: 'id',

            },

            {
                title: '消息内容',
                dataIndex: 'body',

            },
            {
                title: '推送时间',
                dataIndex: 'createTime',


            },
            {
                title: '推送人',
                dataIndex: 'createUserId',


            },



        ];
    }
    componentDidMount() {
        this.init();
    }
    handleCancel = () => {
        this.setState({
            visible: false
        })
    }

    init = () => {
        const { offlineMsgList } = this.props
        offlineMsgList({ pageNo: 1, pageSize: 10 })
    }

    handleChangeLabelList = (current, pageSize) => {
        this.props.offlineMsgList({ pageNo: current, pageSize: 10 })
    }



    render() {
        const { offlineMsgData} = this.props;
        const { pageNum, pageSize, visible } = this.state;
        const pagination = {
            current: offlineMsgData.current,//当前页
            total: offlineMsgData.total,//总条数
            pageSize: offlineMsgData.pageSize,//页大小
            onChange: this.handleChangeLabelList,
            showQuickJumper: true,//快速跳转
            showSizeChanger: false//大于50时显示pageSize切换器
        };
        return (
            <div>
                <Table columns={this.columns}
                    dataSource={offlineMsgData.records} rowKey={record => record.id}
                    pagination={pagination}
                />
            </div>

        );
    }
}


const mapState = state => ({
    ...state.systemInfo
});

const mapDispatch = dispatch => ({
    ...dispatch.systemInfo

})

export default connect(mapState, mapDispatch)(OfflineMsgList);